package com.bjdd.jdy.ui.wallet;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bjdd.jdy.R;
import com.bjdd.jdy.base.BaseActivity;
import com.bjdd.jdy.entity.User;
import com.bjdd.jdy.util.JumpUtil;
import com.bjdd.jdy.util.SpUtil;
import com.bjdd.jdy.util.StatusBarUtil;
import com.zhy.autolayout.AutoLinearLayout;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class WalletActivity extends BaseActivity<WalletPresenter, WalletModel> implements WalletContract.View {

    @Bind(R.id.toolbar_back)
    ImageView toolbarBack;
    @Bind(R.id.title)
    TextView title;
    @Bind(R.id.tv_money)
    TextView tvMoney;
    @Bind(R.id.all_withdrawals)
    AutoLinearLayout allWithdrawals;
    @Bind(R.id.all_bankcard)
    AutoLinearLayout allBankcard;
    @Bind(R.id.tv_toolbar_right)
    TextView tvToolbarRight;

    @Override
    public int getLayoutId() {
        return R.layout.activity_wallet;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.toolbar_bg), 0);
        title.setText("我的钱包");
        tvToolbarRight.setText("交易记录");
        tvToolbarRight.setVisibility(View.VISIBLE);
        //presenter.getUserInfo(SpUtil.getToken(),SpUtil.getUser().getCarrierId());
    }


    @OnClick({R.id.toolbar_back, R.id.all_withdrawals, R.id.all_bankcard,R.id.tv_toolbar_right})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.toolbar_back:
                finish();
                break;
            case R.id.all_withdrawals:
                JumpUtil.toWithDraw(context);
                break;
            case R.id.all_bankcard:
                JumpUtil.toBankCard(context);
                break;
            case R.id.tv_toolbar_right:
                JumpUtil.toDealRecord(context);
                break;
        }
    }

    @Override
    public void userInfoSuccess(User user) {
        tvMoney.setText("￥"+user.getMoney());
    }
}
